//package com.ruoyi.web.utils;
//
//import com.alibaba.dashscope.app.Application;
//import com.alibaba.dashscope.app.ApplicationParam;
//import com.alibaba.dashscope.app.ApplicationResult;
//import com.alibaba.dashscope.exception.InputRequiredException;
//import com.alibaba.dashscope.exception.NoApiKeyException;
//import io.reactivex.Flowable;
// 
//
///**
// * @author py
// * @date 2025/3/10 15:59
// * @description ai工具类
//*/
//public class AiUtil {
//    // 通义千问id
//    private static String tyQwId;
//
//    // 通义千问key
//    private static String tyQwKey;
//
//    // 获取初始值
//    public static void init(String tyQwId, String tyQwKey) {
//        AiUtil.tyQwId = tyQwId;
//        AiUtil.tyQwKey = tyQwKey;
//    }
//
//    /**
//     * 获取通义千问消息
//     * @param prompt    提示词
//     * @return
//     * @throws NoApiKeyException
//     * @throws InputRequiredException
//     */
//    public static String getTyQwMessage(String prompt) throws NoApiKeyException, InputRequiredException {
//        ApplicationParam param = ApplicationParam.builder()
//                .apiKey(tyQwKey)
//                .appId(tyQwId)
//                .prompt(prompt)
//                .build();
//
//        Application application = new Application();
//        ApplicationResult result = application.call(param);
//        return result.getOutput().getText();
//    }
//
//    public static Flowable<ApplicationResult> getTyQwFluxMessage(String prompt) throws NoApiKeyException, InputRequiredException {
//        ApplicationParam param = ApplicationParam.builder()
//                .apiKey(tyQwKey)
//                .appId(tyQwId)
//                .prompt(prompt)
//                .incrementalOutput(true)
//                .build();
//
//        Application application = new Application();
//        Flowable<ApplicationResult> result = application.streamCall(param);
//        return result;
//    }
//
//
//
//
//}